package com.wz.jiangsu.wangteng;

import java.io.*;
  
public class FileWriterExample {  
    public static void main(String[] args) {  
        try {  
            // 创建一个FileWriter对象，用于写入文件  
            FileWriter writer = new FileWriter("input.txt", true); // true表示追加写入文件
  
            // 创建一个BufferedWriter对象，用于缓存写入操作  
            BufferedWriter buffer = new BufferedWriter(writer);  
  
            // 循环写入5行文本，每行后进行换行
            for (int i = 0; i < 5000; i++) {
                buffer.write("2018 Apr 04 13:11:52 nba_program: this_is_an_example: \" player_information_" + i + ": \"{ \"name\": \"Stephen\", \"surname\": \"Curry\", \"team\": \"Golden State Warriors\", \"number\": 30, \"position\": \"point guard\"}");
                buffer.newLine(); // 写入换行符  
            }  
  
            // 关闭BufferedWriter对象  
            buffer.close();  
        } catch (IOException e) {  
            e.printStackTrace();  
        }  
    }}